<%@ page import="com.mysql.cj.api.xdevapi.Collection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.sql.Connection" %><%--
  Created by IntelliJ IDEA.
  User: 自由如风
  Date: 2018/3/26
  Time: 18:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>删除用户</title>

    <style type="text/css">
        a {
            font-size: 8px;
        }

    </style>
</head>
<body>
<a href="userList.jsp">返回列表</a>

<%
    String idstr = request.getParameter("idvalue");
    Connection connection = null;
    Statement statement = null;

    try {

        Class.forName("com.mysql.cj.jdbc.Driver");

        connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sctu_javaweb_2018?serverTimezone = UTC", "root", "193749");

        statement = connection.createStatement();
        statement.executeUpdate("DELETE FROM t_users WHERE id = " + idstr + "");

    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        try {
            connection.close();
            statement.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
%>

<p>删除成功!</p>
</body>
</html>
